1. Field of the Invention
The present invention relates to a white level detection circuit for an optical image reader, such as an optical character reader (OCR), a bar code reader or an image scanner.
2. Description of the Prior Art
An optical image reader is known which optically reads an image by using opto-electric transducing elements, such as image sensors and photo diodes, and processes image data generated by those elements. An optical character reader (OCR) and a bar code reader are examples of this type of optical image reader. An image signal output from an image sensor is converted into binary image data. The binary image data is processed for recognizing characters and bar codes. It is common practice that image data is processed on the basis of a white level (signal level) corresponding to a background portion of high value (e.g., white color) in the image.
The white level may not be uniform over the image for various reasons, such as nonuniformity of an illuminating light source, deterioration of the efficiency of an imaging lens around the fringe of the image by the cos.sup.4 rule, the quality of paper bearing the image data and dirt on the surface of the paper. To accurately reproduce an image, it is necessary to accurately know the white level, which varies with location, on the image.
A basic construction of a white level detection circuit thus far employed in a bar code reader, for example, is shown in FIG. 4. The white level detection circuit is essentially a peak hold circuit. An output signal of an image sensor constituting an input image signal is applied through a buffer amplifier 1 and a diode 2 to a capacitor 3. The capacitor 3 is charged with the image signal, and discharged through a resistor 4. A potential appearing at the terminal of the capacitor 3 provides a white level signal, by way of a buffer amplifier 5.
FIG. 5 is a diagram showing a waveform useful in explaining the operation of the white level detection circuit of FIG. 4. The image signal is represented by a curve L1, and the white level signal by a curve L2. Consider the simple case of a black bar code formed on white paper. A white period W corresponds to a white portion in the image, and a black period B, to a black portion (i.e., black bar). A period TB indicates a blank period of the image sensor. When the image signal increases, the capacitor 3 is charged through the diode 2. When the image signal decreases, the capacitor 3 is discharged at a preset time constant, through the resistor 4. When a point being read changes from black to white, the image signal sharply rises and capacitor 3 charges through the diode 2. As a result, during the white period W, a white level signal, equal to the image signal, is output. When the point being read changes from black to white, the image signal sharply falls. Capacitor 3 discharges thereby maintaining the image signal substantially equal to the value during the previous white period W. Changes in the white level, which are due to changes of value or brightness in the white portion on the paper, are subtle. Accordingly, when the white level on the paper falls, the white level signal accurately follows the fall of the white level.
In the prior art, if a relatively long black portion exists, a long black period BL appears, as shown in FIG. 6. In this situation, the discharge of the capacitor 3 is completed by the end of the long black period BL. The white level signal (indicated by curve L2) falls to approach to the level of the image signal corresponding to the black portion as shown by reference character al. When the image signal is processed on the basis of such a white level signal, the black portion may be mistakenly recognized as the white portion. Although a mistake in recognition in which the white portion is recognized as the black portion or vice versa would never occur, the image signal of the black portion is increased in comparison to the white level signal, resulting in distortion of the recognized image. The distortion adversely affects the bar code discriminating processing, which includes binary processing.
One approach to solving this problem would be to sufficiently increase the discharge time-constant defined by the capacitor 3 and the resistor 4. This approach, however, may result in the failure of the white level signal to follow the natural fall of the white level on paper.
An arrangement which solved the problem of distorted images, is shown in FIG. 7. The arrangement includes a peak hold circuit 11 which has a variable discharge time-constant. The discharge time constant of the peak hold circuit 11 is selectively changed by a switch circuit 12 which selects a short time constant for the white portion and a long time constant for the black portion. The peak hold circuit 11 includes a capacitor, a diode for charging the capacitor, and a resistor for discharging the capacitor.
An image signal is applied to peak hold circuit 11 and to differentiation circuit 13. A derivative or differential coefficient produced by differentiation circuit 13 is compared to proper threshold levels TH1 and TH2 (TH1&gt;0&gt;TH2) in comparator circuit 14. The output signal of comparator circuit 14 is applied to flip-flop 15 as either set signal S or reset signal R,. thereby controlling switch circuit 12. Switch circuit 12 is rendered conductive or nonconductive depending on the state of flip-flop 15, thereby selecting the discharge time constant of the peak hold circuit 11 to be either short or long, respectively.
FIGS. 8(a) through 8(d) are diagrams showing waveforms useful in explaining the operation of the prior art circuit of FIG. 7. FIG. 8(a) shows an image signal waveform. FIG. 8(b) shows a waveform of the corresponding output signal of differentiation circuit 13. FIG. 8(c) shows a waveform of the resulting output signal of flip-flop 15. FIG. 8(d) shows the resultant output waveform of white level signal from peak hold circuit 11.
The image signal changes sharply at the start and end points of blank period TB and black period B. Pulse signals having polarity based on changes in the image signal, are output from differentiation circuit 13. When the signal is processed from blank period TB to white period W, and from black period B to white period W, the output signal of differentiation circuit 13 becomes a large positive signal, exceeding threshold level THl. As a result, the comparator circuit 14 produces a set signal S, setting the flip-flop 15, which in turn produces an output signal of logic "1". Consequently, switch circuit 12 selects a short discharge time constant of peak hold circuit 11. Accordingly, during period W, the white level signal accurately follows the change of the image signal.
When the signal is processed from white period W to either blank period TB or black period B, the output signal of differentiation circuit 13 is negative in polarity, falling below threshold value TH2. As a result, reset signal R is derived from comparator circuit 14, and resets the flip-flop 15 which in turn produces an output signal of logic "0". In response, switch circuit 12 selects a large discharge time-constant of the peak hold circuit 11. As a result, even if black period B is long, the white level signal can substantially maintain its value from the end of the previous white period. Accordingly, the black portion will not be mistaken for the white portion because the image distortion caused when the image signal in the black portion increases relative to the white level signal has been eliminated.
However, this prior art is not problem-free. When the white level on the paper surface falls during a long black period B, a proper white level signal cannot be obtained during the subsequent white period. This problem will be further described below with respect to FIGS. 9(a) and 9(b).
If, as shown in FIG. 9(a), the white level on the read surface increases by .DELTA.wl during the long black period BLl, peak hold circuit 11 immediately increases the white level signal which follows the image signal variation, during the white period W following the black period BLl. To the contrary, if as shown in FIG. 9(b), the white level on the read surface decreases by .DELTA.w2 during the long black period BL2, peak hold circuit 11 cannot immediately follow a variation of the decreased image signal during the white period W after the black period BL2. Rather, it slowly follows the variation of the decreased image signal at a time constant. As a result, during the white period W following black period BL2, a white level signal which is higher than the actual white level is output because image signal input during the white period W after the black period BL2 is lower than the white level signal retained in peak hold circuit 11 and cannot actively charge the capacitor in peak hold circuit 11. In other words, the circuit, out of necessity, waits until completion of the discharge of the capacitor with a time constant, in order that the white level signal changes after the image signal changes. Otherwise, when the white level signal is improper during the white period W, the white image is distorted.
A similar problem also arises when the white level of the image changes at the start point and the end point of the image scanning period. When the white level of the image signal at the start point of the scan period is higher than the white level at the end point by .DELTA.w, as shown in FIG. 10, the white level signal retained during blank period TB cannot immediately follow the image signal variation in the leading portion of the white period subsequent to blank period TB. As a result, as in the above case, the image in the white portion is distorted.
Accordingly, an object of the present invention is to provide a white level detection circuit for an optical image reader which produces a white level signal that accurately follows a variation of the white level on the surface, and produces a white level signal that allows for excellent processing of the image signal corresponding to the black portion.